<?php
class Lang {

    public static $module = '';
    public static $category = 'app';

    public static function setModule($module) {
        self::$module = ucfirst(strtolower($module));
        self::$category = self::$module . 'Module.' . self::$category;
    }

    public static function setCategory($category) {
        self::$category = implode('.', array_filter(array(
            empty(self::$module) ? '' : self::$module . 'Module',
            $category,
        )));
    }

    public static function resetCategory($category = 'app') {
        self::setCategory($category);
    }

    public static function t($string, $params = array()) {
        return Yii::t(self::$category, $string, $params);
    }

}